package com.star.common.model;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 分页对象
 *
 * @author xiaoqiang
 * @version 1.0
 * @date 2020/8/5 16:43
 */
@Data
@NoArgsConstructor
public class BasePage<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer current = 1;
    private Integer size = 10;
    private Long total = 1L;
    private List<T> data;

    public BasePage(IPage<T> page) {
        this.setTotal(page.getTotal());
        this.setSize((int)page.getSize());
        this.setCurrent((int)page.getCurrent());
        this.setData(page.getRecords());
    }


}
